//
//  WSMineHeadSubView.m
//  LANGirl
//
//  Created by 吴帅 on 16/3/28.
//
//

#import "WSMineHeadSubView.h"

@interface WSMineHeadSubView ()



@end

@implementation WSMineHeadSubView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

- (void)createSubView {

    //简历图片
    self.icoImage = [[UIImageView alloc]init];
    [self addSubview:_icoImage];
    [self.icoImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-44.00*AUTO_WIDTH/2);
        make.left.mas_equalTo(30.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake((34.00)*AUTO_WIDTH, 34.00*AUTO_WIDTH));
    }];
    
    
    //简历
    self.typeLabel = [[UILabel alloc]init];
    self.typeLabel.font=[UIFont systemFontOfSize:12.00 *TEXTWEIGHT];
    self.typeLabel.alpha=0.6;
    [self addSubview:_typeLabel];
    [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(-50.00*AUTO_WIDTH/2);
        make.left.equalTo(self.icoImage.mas_right).offset(15.00*AUTO_WIDTH/2);
        make.height.mas_equalTo(12.00 * AUTO_WIDTH);
        make.right.mas_equalTo(@-5);
    }];
    
    //4
    self.numberLabel = [[UILabel alloc]init];
    self.numberLabel.font=[UIFont fontWithName:SHUZI size:TEXTCONTENTFONT2*TEXTWEIGHT];
    [self addSubview: self.numberLabel];
    [ self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.typeLabel.mas_top).offset(-3);
        make.left.equalTo(self.icoImage.mas_right).offset(15.00*AUTO_WIDTH/2);
        make.height.mas_equalTo(18.00 * AUTO_WIDTH);
        make.right.mas_equalTo(@-5);
    }];
    
    
}

- (UIImageView *)lineImage {

    if (!_lineImage) {
        self.lineImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"虚线竖"]];
        self.lineImage.contentMode = UIViewContentModeScaleAspectFill;
        self.lineImage.layer.masksToBounds = YES;
        [self addSubview:_lineImage];
        [self.lineImage mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.centerY.equalTo(self);
            make.right.equalTo(self);
            make.width.mas_equalTo(@1);
            make.height.equalTo(self).multipliedBy(0.6);
        }];
    }
    
    return _lineImage;
}

- (void)setNumberStr:(NSString *)numberStr {

    if (_numberStr != numberStr) {
        _numberStr = numberStr;
        self.numberLabel.text = _numberStr;
    }
}

- (void)setType:(BUTTONTYPE)type {

    if (_type != type) {
        _type = type;
        
        if (_type == BUTTONTYPECV) {
            [self lineImage];
            if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"userType"] isEqualToString:@"1"]) {
                self.typeLabel.text = @"份案例";
                self.icoImage.image = [UIImage imageNamed:@"mainrenwu@2p"];
            }
            else{
//            } if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"userType"] isEqualToString:@"2"]) {
                self.typeLabel.text = @"份任务";
                self.icoImage.image = [UIImage imageNamed:@"mainrenwu@2p"];
            }
//            if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"userType"] isEqualToString:@"3"]){
//                self.typeLabel.text = @"发布过";
//                self.icoImage.image = [UIImage imageNamed:@"1"];
//
//            }
            
        } else if (_type == BUTTONTYPETALK) {
            [self lineImage];
            self.typeLabel.text = @"沟通过";
            self.icoImage.image = [UIImage imageNamed:@"mine_talk@2p"];
        } else {
            self.typeLabel.text = @"收藏过";
            self.icoImage.image = [UIImage imageNamed:@"mine_collect@2p"];
        }
    }
    
}


@end
